package com.dd.logistics;

import com.dd.logistics.config.UploadConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.io.File;

@Slf4j
@SpringBootApplication
public class LogisticsApplication implements CommandLineRunner {
    
    @Autowired
    private UploadConfig uploadConfig;
    
    public static void main(String[] args) {
        SpringApplication.run(LogisticsApplication.class, args);
    }
    
    @Override
    public void run(String... args) throws Exception {
        // 创建上传根目录
        File uploadDir = new File(uploadConfig.getBasePath());
        if (!uploadDir.exists()) {
            uploadDir.mkdirs();
        }
        log.info("上传目录初始化完成：{}", uploadConfig.getBasePath());
    }
} 